//--------------------------------------------------------------------------------
// This file is a portion of the D2D1Renderer.  It is distributed
// under the MIT License, available in the root of this distribution and 
// at the following URL:
//
// http://www.opensource.org/licenses/mit-license.php
//
// Copyright (c) Mirco Timmermann
//
//--------------------------------------------------------------------------------
#include "CanvasGradient.h"


CanvasGradient::CanvasGradient() {
	_x0 = 0;
	_y0 = 0;
	_x1 = 0;
	_y1 = 1;
}

CanvasGradient::CanvasGradient(float x0, float y0, float x1, float y1) {
	_x0 = x0;
	_y0 = y0;
	_x1 = x1;
	_y1 = y1;
}

CanvasGradient::~CanvasGradient(void) {

}

void CanvasGradient::addColorStop(float poisition, const Color color) {
	D2D1_GRADIENT_STOP d2dGradientStop;
	d2dGradientStop.position = poisition;

	D2D_COLOR_F d2dColor;
	d2dColor.r = color.r;
	d2dColor.g = color.g;
	d2dColor.b = color.b;
	d2dColor.a = color.a;

	d2dGradientStop.color = d2dColor;

	_gradientStops.push_back(d2dGradientStop);
}